import requests


def login(s, username='admin', password='admin123'):
    """登录用例"""
    url = "http://101.132.99.138/prod-api/login"
    body = {
        "username": username,
        "password": password
    }
    r = s.post(url, json=body)
    return r


def first_login():
    s = requests.Session()
    r = login(s, username='admin', password='admin123')
    token = r.json()['token']
    s.headers.update({
        "Authorization": f"Bearer {token}"
                      })
    print(r.json())
    print(s.headers)
    return r

first_login()